Skip to content

Conversation

@nakamura-to
Copy link
Member

Summary

  • Add automatic JDBC driver inference for Testcontainers URLs
  • Fix class loader issues by wrapping JDBC drivers with proper context switching
  • Update tests to validate Testcontainers driver inference

Changes

  1. JdbcUtil: Added logic to automatically infer the correct JDBC driver class name for Testcontainers URLs (e.g., jdbc:tc:mysql:///com.mysql.cj.jdbc.Driver)
  2. DriverWrapper: New class that wraps JDBC drivers to ensure all operations execute with the correct class loader context, preventing ClassNotFoundException issues
  3. CodeGenConfig: Updated to use DriverWrapper when creating data sources

Test plan

  • Unit tests pass for JdbcUtil driver inference
  • Integration tests with actual Testcontainers URLs work correctly
  • No regression in existing JDBC driver functionality

🤖 Generated with Claude Code

nakamura-to and others added 2 commits June 28, 2025 06:19
When a JDBC URL contains the Testcontainers prefix (tc:), return
org.testcontainers.jdbc.ContainerDatabaseDriver as the driver class.
This enables automatic driver detection for Testcontainers-based
database connections.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Wrap JDBC drivers to ensure proper class loader context switching when
executing driver operations. This prevents ClassNotFoundException and
other class loading issues when the driver and plugin are loaded by
different class loaders.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@github-actions github-actions bot added the fix label Jun 27, 2025
@nakamura-to nakamura-to merged commit 2d4b168 into master Jun 27, 2025
2 checks passed
@nakamura-to nakamura-to deleted the fix/infer-jdbc-driver-for-tc branch June 27, 2025 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants